package hn.sigit.logic.bpm;

import java.util.ArrayList;
import java.util.List;

import org.jboss.seam.bpm.PooledTaskInstanceList;
import org.jboss.seam.bpm.TaskInstanceList;
import org.jbpm.taskmgmt.exe.TaskInstance;

public class BpmNavigation {
	public static List<TaskInstance> getTaskInstanceList(String processDefinition) {
		List<TaskInstance> taskList = new ArrayList<TaskInstance>();
		TaskInstanceList taskInstanceList = new TaskInstanceList();
		for (TaskInstance task : taskInstanceList.getTaskInstanceList())
			if (task.getProcessInstance().getProcessDefinition().getName().equals(processDefinition))
				taskList.add(task);
		
		return taskList;
	}
	
	public static List<TaskInstance> getPooledTaskInstanceList(String processDefinition) {
		List<TaskInstance> taskList = new ArrayList<TaskInstance>();
		PooledTaskInstanceList taskInstanceList = new PooledTaskInstanceList();
		for (TaskInstance task : taskInstanceList.getPooledTaskInstanceList())
			if (task.getProcessInstance().getProcessDefinition().getName().equals(processDefinition))
				taskList.add(task);
		
		return taskList;
	}

}
